﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Models;
using BLL;

namespace CSMF.Management.Page_HollywoodLoaction
{
    public partial class HLoaction_Detail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["admin"] != null)
                {
                    int id = Convert.ToInt32(Request.QueryString["videoID"]);
                    Hollywood info = HollywoodManager.GetHollywoodByID(id);
                    lblTitle1.Text = info.Title;
                    lblTitle2.Text = info.Title;
                    lblTitle3.Text = info.Title;
                    lblTitle4.Text = info.Title;
                    lblTitle5.Text = info.Title;
                    HollywoodLoaction lo1 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(1, id);
                    txtLocation1.Text = lo1.Location;
                    HollywoodLoaction lo2 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(2, id);
                    txtLocation2.Text = lo2.Location;
                    HollywoodLoaction lo3 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(3, id);
                    txtLocation3.Text = lo3.Location;
                    HollywoodLoaction lo4 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(4, id);
                    txtLocation4.Text = lo4.Location;
                    HollywoodLoaction lo5 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(5, id);
                    txtLocation5.Text = lo5.Location;
                }
                else
                {
                    Response.Write("<script language='javascript'>parent.location.href='../login.aspx';</script>");
                }
            }
        }


        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["videoID"]);
            HollywoodLoaction lo1 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(1, id);
            lo1.Location = txtLocation1.Text.Trim();
            HollywoodLoactionManager.ModifyHollywoodLoaction(lo1);
            HollywoodLoaction lo2 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(2, id);
            lo2.Location = txtLocation2.Text.Trim();
            HollywoodLoactionManager.ModifyHollywoodLoaction(lo2);
            HollywoodLoaction lo3 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(3, id);
            lo3.Location = txtLocation3.Text.Trim();
            HollywoodLoactionManager.ModifyHollywoodLoaction(lo3);
            HollywoodLoaction lo4 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(4, id);
            lo4.Location = txtLocation4.Text.Trim();
            HollywoodLoactionManager.ModifyHollywoodLoaction(lo4);
            HollywoodLoaction lo5 = HollywoodLoactionManager.GetHollywoodLoactionByIDAndH(5, id);
            lo5.Location = txtLocation5.Text.Trim();
            HollywoodLoactionManager.ModifyHollywoodLoaction(lo5);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "aaa", "alert('修改好莱坞视频信息成功。');window.opener.location.replace('../Page_Hollywood/Hollywood_List.aspx');window.close();", true);
        }
       
    }
}
